package com.example.intelligenttransportationteam1;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;

import java.util.Timer;
import java.util.TimerTask;

public class GuideActivity extends AppCompatActivity {
    static boolean flag=true; //true表示首次启动，false表示非首次启动

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_guide);

        Timer timer=new Timer(); //计时器
        TimerTask timerTask=new TimerTask() {  //定义计时任务
            @Override
            public void run() {
                Intent intent=new Intent(getApplicationContext(),LoginActivity.class);
                startActivity(intent); //跳转到主页面
                finish(); //关闭
            }
        };
        if (flag){
            timer.schedule(timerTask,3000); //延时3秒
            flag=false; //已经启动过了
        }else {
            timer.schedule(timerTask,0);
        }

    }
}